package com.youlai.boot.modules.blog.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.boot.common.model.Option;
import com.youlai.boot.modules.blog.service.BlogService;
import com.youlai.boot.system.converter.ArchivesConverter;
import com.youlai.boot.system.model.entity.Archives;
import com.youlai.boot.system.model.query.ArchivesQuery;
import com.youlai.boot.system.model.query.DictDataPageQuery;
import com.youlai.boot.system.model.query.ProjectQuery;
import com.youlai.boot.system.model.vo.ArchivesVO;
import com.youlai.boot.system.model.vo.DictDataPageVO;
import com.youlai.boot.system.model.vo.ProjectVO;
import com.youlai.boot.system.service.ArchivesService;
import com.youlai.boot.system.service.DictDataService;
import com.youlai.boot.system.service.ProjectService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@RequiredArgsConstructor
@Slf4j
public class BlogServiceImpl implements BlogService {

    private final ArchivesService archivesService;

    private final ProjectService projectService;

    private final DictDataService dictDataService;

    private final ArchivesConverter archivesConverter;


    @Override
    public IPage<ArchivesVO> getArchivesPage(ArchivesQuery queryParams) {
        return archivesService.getArchivesPage(queryParams);
    }

    @Override
    public IPage<ProjectVO> getProjectPage() {
        ProjectQuery projectQuery = new ProjectQuery();
        return projectService.getProjectPage(projectQuery);
    }

    @Override
    public Page<DictDataPageVO> getDictDataPage(DictDataPageQuery queryParams) {
        return dictDataService.getDictDataPage(queryParams);
    }

    @Override
    public ArrayList<Archives> getArchivesTop3() {
        return archivesService.getArchivesTop3();
    }

    @Override
    public ArchivesVO getArchivesById(Long id) {
        Archives archives = archivesService.getArchivesById(id);
        return archivesConverter.toArchivesVo(archives);
    }


}
